﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using EntityComponentSystem.Demos.SpaceAttack.Systems;

namespace EntityComponentSystem.Demos.SpaceAttack
{
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        /// 

        public static bool IsRunning = true;

        [STAThread]
        static void Main()
        {
            //Application.EnableVisualStyles();
            //Application.SetCompatibleTextRenderingDefault(false);
            //Application.Run(new Form1());

            var ge = new GameEngine();
            ge.Start();

            var inputSystem = new InputSystem(ge);
            ge.RegisterSystem(inputSystem);

            var moveSystem = new MovementSystem(ge);
            ge.RegisterSystem(moveSystem);

            var renderSystem = new ConsoleRenderSystem(ge);
            ge.RegisterSystem(renderSystem);

            var player = ge.CreateEntity<EntityComponentSystem.Demos.SpaceAttack.Entities.Player>();
            ge.AddToSystem<EntityComponentSystem.Demos.SpaceAttack.Systems.IInputSystem>(player);

            while (IsRunning)
            {
                ge.Tick();
                System.Threading.Thread.Sleep(0);
            }

            ge.Stop();
            ge.Dispose();

        }

    }
}
